package leetcode;

/**
 * @创建人 MBY381
 * @创建时间 2022/4/22 19:45
 * @描述 暂无
 */
public class Solution_jz042 {
    public int maxSubArray(int[] nums) {
        int pre = 0, maxAns = nums[0];
        for (int x : nums) {
            pre = Math.max(pre + x, x);
            maxAns = Math.max(maxAns, pre);
        }
        return maxAns;
    }
}
